#include "QAgreement.h"

QAgreement::QAgreement(QDialog *parent) : QDialog(parent)
{
    //【1】窗口大小设置
    this->setWindowIcon(QIcon(":/ALL/Image/ALL/Cat.png"));
    this->setObjectName("Agreement");
    this->setWindowFlags(Qt::FramelessWindowHint);
    QSize SizeOfAgreement = QSize(800,600);
    this->setFixedSize(SizeOfAgreement);
    //【2】最小化和关闭按钮
    CloseBtn = new QToolButton(this);
    MinimizeBtn = new QToolButton(this);
    CloseBtn->setGeometry(755,0,45,45);
    MinimizeBtn->setGeometry(715,0,45,45);
    CloseBtn->setObjectName("CloseBtn");
    MinimizeBtn->setObjectName("MinimizeBtn");
    //【3】设置LOGO
    LabelOfLOGO = new QLabel(this);
    LabelOfLOGO->setGeometry(300,0,200,200);
    LabelOfLOGO->setObjectName("LOGO");
    //【4】设置协议文本框
    TexteditOfAgreement = new QTextEdit(this);
    TexteditOfAgreement->setGeometry(10,210,780,320);
    TexteditOfAgreement->setReadOnly(true);
    QFile file(":/Text/Text/Agreemend.txt");
    QString str;
    if(!file.open(QFile::ReadOnly))
    {
        TexteditOfAgreement->setText("协议读取出错!");
    }
    else
    {
        str = file.readAll();
        TexteditOfAgreement->setText(str);
    }
    file.close();
    //【5】设置退出按钮
    BtnOfIKnow = new QPushButton(this);
    BtnOfIKnow->setGeometry(300,540,200,60);
    BtnOfIKnow->setText(QString::fromUtf8("我已知晓!"));
    BtnOfIKnow->setObjectName("RegisterBtn");
    //【6】设置样式
    QReadQSS::setStyle(":/QSS/QSS/Rester.qss");
    connect(CloseBtn,SIGNAL(clicked()),this,SLOT(close()));
    connect(MinimizeBtn,&QToolButton::clicked,this,&QAgreement::showMinimized);
    connect(BtnOfIKnow,&QPushButton::clicked,this,&QDialog::close);
}
